{template 'common/header'}

<ul class="nav nav-tabs">
	<li class="active"><a>会员信息列表</a></li>
</ul>
	<div class="panel panel-default">
		<div class="panel-heading">会员列表</div>
		<div class="panel-body">
			<div class="table-responsive panel-body">
				<table class="table table-hover" style="min-width: 300px;">
					<thead class="navbar-inner">
						<tr>
							<th style="width:50px;">ID</th>
							<th style="width:220px;">from_user</th>
							<th style="width:120px;">用户昵称</th>
							<th style="width:120px;">真实姓名</th>
							<th style="width:120px;">电话</th>
							<th style="width:300px;">地址</th>
							<th style="width:100px;">操作</th>
						</tr>
					</thead>
						{loop $members $memberid $member}
						<?php

						$sql="SELECT * FROM ".tablename('tg_order')." WHERE openid=:from_user";
						$params = array(':from_user'=>$member['from_user']);
							$order = pdo_fetchall($sql, $params);
							$arr  = array();
							foreach ($order as $key => $value) {
								$arr['addressid'] = $value['addressid'];
							}

						$sql1 = "SELECT * FROM ".tablename('tg_address')." WHERE id=:addressid";
						$params1  = array(':addressid' => $arr['addressid']);
							$address = pdo_fetch($sql1,$params1);
						?>
						<tr>
							<td>{$member['id']}</td>
							<td>{$member['from_user']}</td>
							<td>{$member['nickname']}</td>
							<td>{$address['cname']}</td>
							<td>{$address['tel']}</td>
							<td>{$address['province']}{$address['city']}{$address['county']}{$address['detailed_address']}
							</td>
						    <td >
							<a href="{php echo $this->createWebUrl('member', array('id' => $member['id'], 'op' => 'delete'))}" onclick="return confirm('此操作不可恢复，确认删除？');"
								class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="删除"><i class="fa fa-times"></i>
							</a>
						</td>
						</tr>
						{/loop}
						{if empty($members)}
						<tr>
							<td colspan="8">
								没有会员信息
							</td>
						</tr>
						{/if}
					</tbody>
				</table>
				{$pager}
			</div>
		</div>
	</div>
</div>

{template 'common/footer'}